FROM golang:1.21.6-alpine3.19 as builder
WORKDIR /app
COPY . .
RUN go env -w GOPROXY=https://goproxy.cn,direct && \
    go build -o main application.go

FROM ubuntu:latest
WORKDIR /app
COPY . .
COPY --from=builder /app/main .
EXPOSE 8080/tcp
ENTRYPOINT /app/main
